//
//  FindViewController.m
//  Hyatt
//
//  Created by QC.L on 15/5/25.
//  Copyright (c) 2015年 QC.L. All rights reserved.
//

#import "FindViewController.h"
#import "QCHttpHandler.h"
#import "QCRound.h"
#import "FindHomePage.h"
#import "MJExtension.h"
#import "FocusImages.h"
#import "Categories.h"
#import "LatestActivity.h"
#import "LatestSpecial.h"
#import "RecommendAlbums.h"
#import "Focus.h"
#import "Menu.h"
#import "Recommend.h"

@interface FindViewController ()
@property (nonatomic, strong) QCRound *round;
@property (nonatomic, strong) FindHomePage *find;
@end

@implementation FindViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    [self.view addSubview:self.round];
    
    [self getData];
    
}
/**
 *  lazyloading
 *
 *  @return
 */
- (QCRound *)round
{

    if (!_round) {
        self.round = [[QCRound alloc] initWithFrame:CGRectMake(10, 74, kWidth - 20, kHeight / 3)];
        NSMutableArray *arr = [NSMutableArray arrayWithObjects:@"zhanweitu", @"zhanweitu", @"zhanweitu", @"zhanweitu", @"zhanweitu", @"zhanweitu", nil];
        _round.imageArr = arr;
    }
    return _round;
}

- (void)getData
{
    [QCHttpHandler get:@"http://mobile.ximalaya.com/m/super_explore_index2?device=iPhone&picVersion=9&scale=2"  body:nil result:QCHttp success:^(id result) {
        
        self.find = [[FindHomePage alloc] initWithDictionary:result];
        // 给轮播图的数组赋值
        self.round.imageArr = self.find.focusImagesModel.focusArr;
        // 制订轮播图的样式
        [self.round configureCellBlock:^(QCRoundCell *cell, id model) {
            Focus *focus = model;
            cell.imageUrl = focus.pic;
        }];

    } failure:^(NSError *error) {
        
    }];
}


@end
